package fr.vincent7894.feedroid.feed.task;

import java.util.Collection;

import fr.vincent7894.feedroid.feed.pojo.Feed;
import fr.vincent7894.feedroid.utils.Logger;
import android.widget.ProgressBar;

public abstract class AbstractProgressFeedTask extends AbstractFeedTask<ProgressBar> {

	public AbstractProgressFeedTask(ProgressBar view) {
		super(view);
	}
	
	@Override
	protected void onProgressUpdate(Integer... values) {
		if(values != null && values.length > 0) {
			Integer value = values[0];
			this.getMediator().getWidget().setProgress(value);	
		}
		else {
			Logger.info("Values is null or empty");
		}
	}
	
	@Override
	protected void onPostExecute(Collection<Feed> result) {
		this.getMediator().getWidget().setProgress(0);
	}
}
